nums =[1,-1,-1,0]
nums.sort()
ans = []
for i in range(len(nums)):
    if i>0 and nums[i] == nums[i-1]:
        continue
    
    tar = -nums[i]

    for j in range(i+1,len(nums)):
        if j>i+1 and nums[j] == nums[j-1]:
            continue

        k = len(nums)-1
        while k>j:
            if nums[j]+nums[k] == tar:
                ans.append([nums[i], nums[j], nums[k]])
                break
            k -= 1

print(ans)

